package com.copa.module.user.mapper;

import com.copa.module.user.domain.dto.UserAddressDto;
import com.copa.module.user.domain.entity.UserAddressEntity;
import com.copa.module.user.domain.vo.UserAddressAddVo;
import com.copa.module.user.domain.vo.UserAddressUpdateVo;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author copa
 * @createDate 2021-01-13
 * @function t_user_address表 Mapper 接口
 */
@Mapper
public interface UserAddressDao extends BaseMapper<UserAddressEntity> {

    List<UserAddressDto> findByUserId(@Param("userId") Long userId);

    Boolean insertUserAddressAddVo(@Param("userAddressAddVo") UserAddressAddVo userAddressAddVo,
                                   @Param("userId") Long userId);

    Boolean updateDefaultAddressByUserId(@Param("userId") Long userId);

    UserAddressUpdateVo findByUserIdAndAddressId(@Param("userId") Long userId, @Param("addressId") Long addressId);

    UserAddressDto findDefaultAddress(@Param("userId") Long userId, @Param("defaultFlag") Integer defaultFlag);
}
